package com.yang.service.api;

import com.yang.service.model.dto.get.ShopGetDTO;
import com.yang.service.model.dto.post.ShopPostDTO;
import com.yang.service.model.dto.put.ShopPutDTO;
import com.yang.service.model.vo.ShopVO;
import com.zhy.base.service.page.PageResult;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;
import java.util.List;

/**
 * Created by xin7k
 * Date: 4:43 下午
 */
@FeignClient(name = "${zhy.endpoint.basedata}")
public interface ShopService {
    /**
     * 保存
     */
    @PostMapping("shop")
    String save(@RequestBody @Valid ShopPostDTO dto);

    /*
     * 根据id查询
     * */
    @GetMapping("shop/{id}")
    ShopVO selectById(@PathVariable(value = "id") String id);

    /*
     * 根据dto查询列表
     * */
    @GetMapping("shop/list")
    List<ShopVO> selectList(@RequestBody ShopGetDTO dto);

    @PutMapping("shop/{id}")
    boolean update(@PathVariable("id") @RequestBody String id,
                   @RequestBody @Valid ShopPutDTO dto);

    @DeleteMapping("shop/{id}")
    boolean deleteById(@RequestBody String id);

    @PostMapping("shop/batch")
    boolean saveBatch(@RequestBody @Valid List<ShopPostDTO> dtos);

    @DeleteMapping("shop/batch")
    boolean deleteBatch(@RequestBody List<String> strings);

    @GetMapping("shop/priority/{number}")
    PageResult<ShopVO> getPriorityShop(@PathVariable(name = "number") Integer number);

}
